package com.atwork.service.impl;

import com.atwork.dao.SysRoleDao;
import com.atwork.model.normal.SysRole;
import com.atwork.service.SysRoleService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @CreateBy: zhaojun
 * @CreateTime: 2018-08-04
 * @Desc: 系统角色模块
 */
@Service
public class SysRoleServiceImpl implements SysRoleService{
    @Autowired
    private SysRoleDao sysRoleDao;

    @Override
    public List<SysRole> getAllRole(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return sysRoleDao.getAllRole();
    }

    @Override
    public int insertRole(SysRole record) {
        return sysRoleDao.insertRole(record);
    }

    @Override
    public SysRole getRoleById(Integer id) {
        return sysRoleDao.getRoleById(id);
    }

    @Override
    public int updateRoleById(SysRole record) {
        return sysRoleDao.updateRoleById(record);
    }

    @Override
    public List<SysRole> getRoleByUserId(Integer userId) {
        return sysRoleDao.getRoleByUserId(userId);
    }
}
